<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    var x = 10
    function fn() {
        console.log(x)
    }
    function show(f) {
        var x = 20
        f()
    }
    show(fn) // 10
</script>
</html>